#
#
#

!include config.vc

PRONAME = fastconv

SRCDIR  = source
INCDIR  = include

##### settings #######
OBJS  = $(OBJDIR)\fcnv_base.obj \
        $(OBJDIR)\fcnv_strlen.obj

##### Compiler flag settings #####

CFLAGS_BASE = $(CFLAGS_BASE) /I$(INCDIR) /I$(SRCDIR) /DBUILD_FASTCONV_LIB

CFLAGS = $(CFLAGS_BASE)
LFLAGS = $(LFLAGS_BASE) /DLL /SUBSYSTEM:WINDOWS /INCREMENTAL:NO

# target description #

debug:
    $(MAKE) BUILD=debug    -f Makefile.vc.mak  libfiles
release:
    $(MAKE) BUILD=release  -f Makefile.vc.mak  libfiles

libfiles:   mk_dir \
            $(BINDIR)\$(PRONAME).lib \
            $(BINDIR)\$(PRONAME).dll \
            $(BINDIR)\testfcnv.exe


$(BINDIR)\$(PRONAME).lib: $(BINDIR)\$(PRONAME).dll

$(BINDIR)\$(PRONAME).dll: $(OBJS) $(SRCDIR)\microsoft.def
    $(LINK) $(LFLAGS) /DEF:$(SRCDIR)\microsoft.def /OUT:$(BINDIR)\$(PRONAME).dll /PDB:$(BINDIR)\$(PRONAME).pdb $(OBJS)

{$(SRCDIR)\}.c{$(OBJDIR)\}.obj:
    $(CC) $(CFLAGS) /Fo$@ $<

$(BINDIR)\testfcnv.exe: $(BINDIR)\$(PRONAME).lib
    $(CC) /I$(INCDIR) /I$(SRCDIR) /Fatestconv.asm /Foobject\testconv.obj /MD /Fe$(BINDIR)\testconv.exe $(SRCDIR)\testfcnv.c bufferoverflowu.lib $(BINDIR)\$(PRONAME).lib

##########################################################
mk_dir:
    if not exist $(OBJDIR) mkdir $(OBJDIR)
clean:
    @echo Removing ...
    @-del $(OBJDIR)\*.obj
    @-del *.obj
    @-del *.exe
    @-del *.dll
    @-del *.lib
    @-del *.ilk
    @-del *.exp
    @-del *.pdb
    @-del *.manifest
    @echo clean finished.

